<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .bg{
            background-color: blue;
        }
        #con{
            width: 400px;
            height: 300px;
            border: 5px solid red;
            padding: 30px;
        }
        #con img{
            width:100%;
        }
    </style>
</head>
<body>
    <div id="con" class="list">
        <img src="./images/1.png" width="100%">
    </div>
</body>
<script>
    //window,getComputedStyle(DOM节点对象,":hover")
    //获取网页元素最终起作用的样式封装对象
    //得到结果为只读对象
    var con = document.getElementById("con");
    var obj = window.getComputedStyle(con);
    if(con.currentStyle){//判断是否为低版本IE浏览器
        console.log(con.currentStyle["backgroundColor"]);
    }else{
        console.log(getComputedStyle(con));
    }
</script>
</html>